<%-- 
    Document   : search
    Created on : Mar 14, 2014, 8:23:51 PM
    Author     : ahmed
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="header.jsp" %>
<script type="text/javascript">
    function validateForm() {
        document.getElementById("idMax").innerHTML = "";
        document.getElementById("idMin").innerHTML = "";

        var x = document.getElementById("max").value;
        if (x == null || x == "") {
            document.getElementById("idMax").innerHTML = "*Enter a number";
            return false;
        }

        var x = document.getElementById("min").value;
        if (x == null || x == "") {
            document.getElementById("idMin").innerHTML = "*Enter a number";
            return false;
        }

        return true;
    }

    function validateForm2() {
        document.getElementById("idName").innerHTML = "";
        var x = document.getElementById("name").value;
        if (x == null || x == "") {
            document.getElementById("idName").innerHTML = "*Enter a product name";
            return false;
        }
        return true;
    }
</script>

<form id="priceSearch" action="SearchByPrice" onsubmit = "return validateForm()">
    Search by Price:
    <br>
    min:<input type="number" name="min" id="min"><div id="idMin"></div>
    <br>
    max:<input type="number" name="max" id="max"><div id="idMax"></div>
    <br>
    <input type="submit" value="Search">
</form>

<form id="nameSearch" action="SearchByName" onsubmit = "return validateForm2()">
    Search by Product Name: <input type="text" name="name" id="name"><div id="idName"></div>
    <br>
    <input type="submit" value="Search">
</form>

<%@include file="footer.jsp" %>
